package org.koyad.portal.tags.html;

import java.io.PrintWriter;

import org.koyad.portal.annotations.TagCordinates;
import org.koyad.portal.constants.FrameworkConstants;
import org.koyad.portal.context.PistonContext;
import org.koyad.portal.tags.Attribute;
import org.koyad.portal.tags.AbstractTag;

@TagCordinates(uri = FrameworkConstants.HTML5_NAMESPACE, localName = "html")
public class HtmlTag extends AbstractTag {

//	private static final LogUtils LOGGER = LogUtils.getLogger(HtmlTag.class);

	@Override
	public void postInit() {
		for(Attribute att : _atts) {
			if(att.getName().equals("session")) {
				if(att.getValue().equals("false")) {
					PistonContext.getContext().getViewRoot().setSession(false);
				}
				_atts.remove(att);
				break;
			}
		}
	}
	
	@Override
	public void render() {
		PrintWriter out = getWriter();

		// write to response
		out.write("<!DOCTYPE html>\n");
		
		super.render();
	}

}
